package com.zzl.bonds.ticket.constant;

import java.util.ArrayList;
import java.util.List;

/**
 * 联系人票关系业务类型枚举类
 *
 * @author szsw
 * @date 2021/12/23 17:05:03
 */
public enum TicketBookRelationTypeEnum {

    /**
     *
     */
    BRT_OPEN                            (1, "开立", TicketBookRelationTypeConstant.TICKET_BOOK_OPEN),
    BRT_SIGN_OPEN                       (2, "开立签收",TicketBookRelationTypeConstant.TICKET_BOOK_OPEN),
    BRT_TRANSFER                        (3, "转让",TicketBookRelationTypeConstant.TICKET_BOOK_TRANSFER),
    BRT_SIGN_TRANSFER                   (4, "转让签收",TicketBookRelationTypeConstant.TICKET_BOOK_TRANSFER),
    BRT_FINANCE                         (5, "融资",TicketBookRelationTypeConstant.TICKET_BOOK_FINANCE),
    BRT_EXCEPTION                       (6, "异常",TicketBookRelationTypeConstant.TICKET_BOOK_EXCEPTION),
    ;
    private Integer code;
    private String name;
    private String type;

    TicketBookRelationTypeEnum(Integer code, String name, String type) {
        this.code = code;
        this.name = name;
        this.type = type;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    /**
     * 获取业务的类型
     * @param type 业务类型
     * @return
     */
    public static List<Integer> getCodeByType(String type) {
        List<Integer> list=new ArrayList<>();
        for (TicketBookRelationTypeEnum typeEnum : TicketBookRelationTypeEnum.values()) {
            if (typeEnum.type.equals(type)) {
                list.add(typeEnum.code);
            }
        }
        return list;
    }

}
